<?php


namespace App\Http\Controllers\applets\validate;


use Illuminate\Support\Facades\Validator;

class App
{
    public static function getAdminApp($param){
        $rules = [
            'type'=>'required|numeric'
        ];
        $msg = [
            'type.required'=>'类型为空',
            'type.numeric'=>'类型格式不对'
        ];

        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function getAdminAppDetails($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }
    
    public static function querySnLogInfo($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function getAppUseTimeLog($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function getInstallAppList($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function checkRefresh($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryAppLog($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryIdApp($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function queryParentApp($param){
        $rules = [
            'snId'=>'required|numeric',
        ];
        $msg = [
            'snId.required'=>'设备编号为空',
            'snId.numeric'=>'设备编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function deleteParent($param){
        $rules = [
            'userId'=>'required|numeric',
            'snId'=>'required|numeric',
            'appId'=>'required|numeric',
            'lastIp'=>'required|ip'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'snId.required'=>'设备编号为空',
            'snId.numeric'=>'设备编号格式不对',
            'appId.required'=>'应用编号为空',
            'appId.numeric'=>'应用编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function adminApp($param){
        $rules = [
            'userId'=>'required|numeric',
            'snId'=>'required|numeric',
            'appId'=>'required|numeric',
            'lastIp'=>'required|ip'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'snId.required'=>'设备编号为空',
            'snId.numeric'=>'设备编号格式不对',
            'appId.required'=>'应用编号为空',
            'appId.numeric'=>'应用编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function editAppAll($param){
        $rules = [
            'userId'=>'required|numeric',
            'lastIp'=>'required|ip',
            'id'=>'required|numeric',
            'is_lock'=>'required',
            'is_network'=>'required',
            'is_upgrade'=>'required',
            'inside_status'=>'required',

        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
            'id.required'=>'应用编号为空',
            'id.numeric'=>'应用编号格式不对',
            'is_lock.required'=>'is_lock为空',
            'is_network.required'=>'is_network为空',
            'is_upgrade.required'=>'is_upgrade为空',
            'inside_status.required'=>'应用ID管控开关为空',

        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function editAppSilent($param){
        $rules = [
            'userId'=>'required|numeric',
            'snId'=>'required|numeric',
            'appId'=>'required|numeric',
            'lastIp'=>'required|ip'
        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'snId.required'=>'设备编号为空',
            'snId.numeric'=>'设备编号格式不对',
            'appId.required'=>'应用编号为空',
            'appId.numeric'=>'应用编号格式不对',
            'lastIp.required'=>'IP地址为空',
            'lastIp.ip'=>'IP地址格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function querySumAppLog($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }
    
    public static function cleanAppCache($param){
        $rules = [
            'id'=>'required|numeric',
        ];
        $msg = [
            'id.required'=>'编号为空',
            'id.numeric'=>'编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function whiteAppUpdate($param){
        $rules = [
            'userId'=>'required|numeric',
            'snId'=>'required|numeric',
            'package'=>'required',

        ];
        $msg = [
            'userId.required'=>'用户编号为空',
            'userId.numeric'=>'用户编号格式不对',
            'package.required'=>'包名为空',
            'snId.required'=>'设备编号为空',
            'snId.numeric'=>'设备编号格式不对',

        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

    public static function whiteAppBySnId($param){
        $rules = [
            'snId'=>'required|numeric',
        ];
        $msg = [
            'snId.required'=>'sn编号为空',
            'snId.numeric'=>'sn编号格式不对',
        ];
        return Validator::make($param,$rules,$msg)->errors()->all();
    }

}